#pragma once

/////////////////////////////////////////////////////////////////////////////
// CFormatEdit window

extern UINT WM_EDIT_KILL_FOCUS;
extern UINT WM_EDIT_VK_ESCAPE;

class TestNumber;
#include <memory>
class CFormatEdit: public CEdit
{
	// Construction
public:
	CFormatEdit();

	// Attributes
public:
private:
	COLORREF m_TextColor;
	COLORREF m_BackColor;
	CBrush   m_Brush;

	BOOL	m_bMessageSent;
	// Operations
public:
	void    SetTextColor(COLORREF col);
	void    SetBackColor(COLORREF col);

	BOOL	SetCurrentMask(CString csNewMask);
	CString GetCurrentMask();
	BOOL	SetValidEditChars(CUIntArray* arChars);
	__int64 GetTestNumber();
protected:
	BOOL ProcessPaste();
	BOOL ProcessClear();
	virtual BOOL IsValidEditChar(TCHAR tcChar);
	
	void SendRegisteredMessage(UINT nMsg, WPARAM wParam = 0, LPARAM lParam = 0);
	//virtual BOOL PreTranslateMessage(MSG *pMSG);
	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFormatEdit)
protected:
	virtual void PreSubclassWindow();
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);

	//}}AFX_VIRTUAL

	// Implementation
public:
	virtual ~CFormatEdit();

	// Generated message map functions
protected:
	//{{AFX_MSG(CFormatEdit)
	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

	CString		m_FormatMask;									// holds the MAC mask
	CUIntArray	m_arCharList;								// holds all valid edit chars
	BOOL		m_bControlDown;
	
public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	std::tr1::shared_ptr<TestNumber> pTestNumber;
};